package com.gm.wj.dao;

import com.gm.wj.entity.AdminRole;
import com.gm.wj.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Map;

/**
 * @author Evan
 * @date 2019/4
 */
public interface UserDAO extends JpaRepository<User,Integer> {
    User findByUsername(String username);

    User getByUsernameAndPassword(String username,String password);

    @Query(value = "SELECT \n" +
            "\n" +
            "table_name \n" +
            "\n" +
            "FROM\n" +
            "\n" +
            "information_schema.tables \n" +
            "\n" +
            "WHERE table_schema = ? \n" +
            "\n" +
            "AND table_type = ? ",nativeQuery = true)
    List<Map<String,Object>> selectTableNames(String table_schema,String table_type );
}
